import request from './index';
// 获取验证码
const getCode = data => request.get('/validCode', { params: data });
// 注册
const register = data => request.put('/register', data);
// 登陆
const login = data => request.post('/login', data);
// 重置密码获取验证码
const resetPasswordGetCode = data => request.get('http://localhost:8888/resetPasswordGetCode', { params: data });
// 重置密码
const resetPassword = data => request.get('http://localhost:8888/resetPassword', { params: data });
// 获取三级联动
const getProvinceMessage = () => request.get('http://www.mxnzp.com/api/address/list');
// 获取指定省的信息
const getAreaMessage = data => request.get(`http://www.mxnzp.com/api/address/search?type=0&value=${data}`);
// 添加收货地址
const customerAddress = data => request.put('/addr', data);
// 获取收货地址
const getShippingAddress = data => request.get('/addr', { params: data });
// 删除收货地址
const rmShippingAddress = data => request.delete('/addr', { params: data });
// 修改收货地址
const resetShippingAddress = data => request.post('/addr', data);
// 设置默认地址
const defaultAddr = data => request.post('/defaultAddr', data);
// 获取商品信息
const mallData = data => request.get('/prod', { params: data });
// 轮播图
const banner = () => request.get('/banner');
// 秒杀商品
const secKill = data => request.get('/secKill', { params: data });
// const MockData = () => request.get('http://www.123.com');
// 添加商品到购物车
const cart = data => request.put('/cart', data);
// 获取商品信息
const getCart = data => request.get('/cart', { params: data });
// 删除购物车的商品
const delCart = data => request.post('/delcart', data);
// 更新购物车商品数量
const updateNum = data => request.post('/cart', data);
// 获取购物车的商品
const getCartNum = data => request.get('/cartCount', { params: data });
// 创建订单
const order = data => request.put('/order', data);
// 支付接口
const pay = data => request.post('/pay', data);
// 搜索联想
const searchProd = data => request.get('/searchProd', { params: data });
// 查询订单
const queryOrder = data => request.get('/order', { params: data });
export default {
  getCode,
  register,
  login,
  resetPasswordGetCode,
  resetPassword,
  getAreaMessage,
  getProvinceMessage,
  customerAddress,
  getShippingAddress,
  rmShippingAddress,
  // MockData,
  resetShippingAddress,
  defaultAddr,
  mallData,
  banner,
  secKill,
  cart,
  getCart,
  delCart,
  updateNum,
  getCartNum,
  order,
  pay,
  searchProd,
  queryOrder,
};
